function selectStudent() {//ѡȡѧ����js
	//alert("sss");
	var sRet = window.showModalDialog("selectStudent.do?student.stu_d_id="+document.getElementById("xb").value+"&student.stu_c_id="+document.getElementById("bj").value+"&student.stuid="+document.getElementById("xsid").value+"&date="+new Date(),'title','scrollbars=no;resizable=no;help=no;status=no;dialogTop=400; dialogLeft=400;dialogHeight=200px;dialogwidth=300px;');
	if(typeof(sRet)!="undefined"){
		var result = sRet.split("&");
   		document.getElementById("xsid").value=result[0];
   		document.getElementById("xs").value=result[1];
   		document.getElementById("xb").value=result[2];
   		document.getElementById("bj").value=result[3];
   	}
}

function selectClass() {//ѡȡ�༶����js
	var sRet = window.showModalDialog("selectClass.action?student.stu_d_id="+document.getElementById("bmid").value+"&student.stu_c_id="+document.getElementById("bjid").value+"&date="+new Date(),'title','scrollbars=no;resizable=no;help=no;status=no;dialogTop=400; dialogLeft=400;dialogHeight=200px;dialogwidth=300px;');
	if(typeof(sRet)!="undefined"){
		var result = sRet.split("&");
   		document.getElementById("bjid").value=result[0];
   		document.getElementById("bj").value=result[1];
   		document.getElementById("bmid").value=result[2];
   		document.getElementById("bm").value=result[3];
   	}
}
//ȥ��ո�ʹ�÷���ͬjava��trim();ֱ��.trim();
  String.prototype.trim = function(){
  return this.replace(/(^\s*)|(\s*$)/g, "");
 }
function $(id){
	return document.getElementById(id).value;
}
function $$(id){
	return document.getElementById(id);
}
function checkOnly(s,sql,prompt){//DWR�ж�sql�е�s�ֶ��Ƿ����ظ�ֵ���еĻ���ݴ������ʾ��䵯��Ի��򲢰�s��ֵ�ÿ�
	if(s.value==""){return true;}
	DWREngine.setAsync(false);
	Tools.getInt(sql,function(count){
		if(count>0){
			alert(prompt);
			s.value = "";
			return false;
		}
	});
	return true;
}
function checkOnlyOne(sql,prompt){//DWR�ж�sql�е�s�ֶ��Ƿ����ظ�ֵ���еĻ���ݴ������ʾ��䵯��Ի���
	DWREngine.setAsync(false);
	Tools.getInt(sql,function(count){
		if(count>0){
			alert(prompt);
			return false;
		}
	});
	return true;
}
function getOptions(s,id,headValue,sql){//����j����-�б�
	DWREngine.setAsync(false);
	if(s == ""){
		dwr.util.removeAllOptions(id);
		$$(id).add(new Option(headValue,""));
	}else{
		Tools.getMapForSelect(sql,function(map){
			dwr.util.removeAllOptions(id);
			$$(id).add(new Option(headValue,""));
			dwr.util.addOptions(id,map);
		});
	}
}
function getPopedomClassMap(s,id,headValue,userid,roleLevel){//��ȡ��Ȩ�޵İ༶�б�
	DWREngine.setAsync(false);
	if(s == ""){
		dwr.util.removeAllOptions(id);
		$$(id).add(new Option(headValue,""));
	}else{
		Tools.getClassMap(s,userid,roleLevel,function(map){
			dwr.util.removeAllOptions(id);
			$$(id).add(new Option(headValue,""));
			dwr.util.addOptions(id,map);
		});
	}
}
function checkNotNull(id,prompt){//�ж�id�ֶ�Ϊ�ǿ�
	if($(id) == ""){
		alert(prompt);
		return false;
	}
	return true;
}
function checkHasSelect(id,prompt){//�ж�id�ֶ�Ϊ��ѡ��
	if($$(id).selectedIndex == 0){
		alert(prompt);
		return false;
	}
	return true;
}
function getText(id){
	return $$(id).options[$$(id).selectedIndex].text;
}
function getContent(id1,id2){//����-�б�id1����ʾ��ֵ����id2,ǰ������-�б�ĵ�һ�����Ч��ֵ���硰��ѡ��֮���
	if($$(id1).selectedIndex != 0){
		$$(id2).value = $$(id1).options[$$(id1).selectedIndex].text;
	}
}
function shuzi(){//0-9
	if(window.event.keyCode>57||window.event.keyCode<48){
		window.event.keyCode = 0;
	}
}
function xiaoshu(){//0-9�͡�.
	if(window.event.keyCode>57||window.event.keyCode<48 && window.event.keyCode != 46){
		window.event.keyCode = 0;
	}
}
function phone(){//0-9�͡�-����Ч
	if(window.event.keyCode>57||window.event.keyCode<48 && window.event.keyCode != 45){
		window.event.keyCode = 0;
	}
}
function number(){//0-9����.���͡�-����Ч
	if(window.event.keyCode>57||window.event.keyCode<48 && window.event.keyCode != 46 && window.event.keyCode != 45){
		window.event.keyCode = 0;
	}
}
function search(){
	if(document.getElementById("search").style.display=='none'){
		document.getElementById("search").style.display='block';
	}else{
		document.getElementById("search").style.display='none';
	}
}
function checkShuzi(s,prompt){
	if(s.value=="")return;
	if(!/^\d+(\.\d+)?$/.test(s.value)){
		alert(prompt);
		s.value = "";
	}
}
function checkNumber(s){
	if(s.value=="")return;
	if(isNaN(s.value)){
		alert("\u4E0D\u662F\u6B63\u786E\u7684\u6570\u503C\u7C7B\u578B\uFF01");
		s.value = "";
	}
}
function checkMail(s,prompt){//��֤��������
	if(s.value=="")return;
	if(s.value.length!=6 || !/^\d{6}$/.test(s.value)){
		alert(prompt);
		s.value = "";
	}
}
function checkEmail(s,prompt){//��֤�����ʼ�
	if(s.value==""){return;}
	if(!/^\S+@\S+(\.\S+)+$/.test(s.value)){
		alert(prompt);
		s.value = "";
	}
}
function checkPhone(s,prompt){//��֤�绰����ķ���
	if(s.value==""){return;}
	if(!/^\d{3}\d?-?\d{7}\d?(-\d{3})?$/.test(s.value)){
		alert(prompt);
		s.value = "";
	}
}
function checkboxselectall(s,name){//������s����ʱ������Ϊname��checkbox���󼯺�����ȫѡ
	var name=document.getElementsByName(name);
	for(var i=0;i<name.length;i++){
			name[i].checked=s.checked;
	}
}
function checkboxselected(name){//�ж�checkbox�Ƿ�ѡ��
	var name=document.getElementsByName(name);
	var flag=false;
	for(var i=0;i<name.length;i++){
		if(name[i].checked){
			flag=true;
			break;
		}
	}
	return flag;
}
function checkSfzh(s,prompt){//����֤���֤�ŵķ���
	if(s.value == ""){return;}
	if(!/^\d{15}(\d{2}[0-9Xx])?$/.test(s.value)){
		alert(prompt);
		s.value = "";
	}
}


 
